$(function () {
    let ownPage = document.querySelector('.subNav>a:nth-of-type(3)')
    let brandName = getQueryString('brandName')
    let src
    let product = document.querySelector('#product>.product')
    let brandtitleid = getQueryString('brandtitleid')
    fetch('http://chst.vip:1234/api/getbrandproductlist?brandtitleid=' + brandtitleid + '&pagesize=10')
        .then(body => body.json())
        .then(res => {
            console.log(res)
            let productStr = ""
            res.result.forEach(item => {
                productStr += `<li productid=${item.productId} categoryid=${item.categoryId}>
        ${item.productImg}
        <div>
            <p>${item.productName}<br><span>${item.productPrice}</span></p>
            <div>
                <span>${item.productQuote}</span>
                <div>
                    <span>${item.productCom}</span>
                </div>
            </div>
        </div>
    </li>`
            })
            product.innerHTML = productStr
            let lis = document.querySelectorAll('#product>.product>li')
            for (var k = 0; k < lis.length; k++) {
                lis[k].onclick = function () {
                    let id = this.getAttribute('productid')
                    let categoryid = this.getAttribute('categoryid')
                    location.href = './brandListDetail.html?productid=' + id + '&brandtitleid=' + brandtitleid + '&title=' + brandName
                }
            }
        })
    ownPage.innerHTML = brandName
    ownPage.onclick = function () {
        location.reload()
    }
})